Component({
  properties: {
    show: {
      type: Boolean,
      value: false
    },
    value: {
      type: String,
      value: ''
    }
  },

  data: {
    inputValue: ''
  },

  observers: {
    'value': function(val) {
      if (val) {
        this.setData({
          inputValue: val
        });
      }
    }
  },

  methods: {
    onInputChange(e) {
      this.setData({
        inputValue: e.detail.value
      });
    },

    onCancel() {
      this.triggerEvent('cancel');
    },

    onConfirm() {
      this.triggerEvent('confirm', { value: this.data.inputValue });
    },

    preventTouchMove() {
      // 阻止背景滚动
    }
  }
}) 